/*
 * Copyright (c) 2010-2014 lijunlin All Rights Reserved.
 * The software source code all copyright belongs to the author, 
 * without permission shall not be any reproduction and transmission.
 */
package org.walkerljl.commons.io;

import org.walkerljl.commons.Constants;

/**
 * {@link FileUtils File utilities} parameters.
 * @author lijunlin
 */
public class FileUtilParams implements Cloneable {

	/** should destination file have the same timestamp as source*/
	protected boolean preserveDate = true;				
	/** overwrite existing destination*/
	protected boolean overwrite = true;					 
	/** create missing subdirectories of destination*/
	protected boolean createDirs = true;				 
	/** use recursive directory copying and deleting*/
	protected boolean recursive = true;					
	/** don't stop on error and continue job as much as possible*/
	protected boolean continueOnError = true;			 
	/** default encoding for reading/writing strings*/
	protected String encoding = Constants.DEFAULT_ENCODING;

	public boolean isPreserveDate() {
		return preserveDate;
	}
	
	public FileUtilParams setPreserveDate(boolean preserveDate) {
		this.preserveDate = preserveDate;
		return this;
	}

	public boolean isOverwrite() {
		return overwrite;
	}
	
	public FileUtilParams setOverwrite(boolean overwrite) {
		this.overwrite = overwrite;
		return this;
	}

	public boolean isCreateDirs() {
		return createDirs;
	}
	
	public FileUtilParams setCreateDirs(boolean createDirs) {
		this.createDirs = createDirs;
		return this;
	}

	public boolean isRecursive() {
		return recursive;
	}
	
	public FileUtilParams setRecursive(boolean recursive) {
		this.recursive = recursive;
		return this;
	}

	public boolean isContinueOnError() {
		return continueOnError;
	}
	
	public FileUtilParams setContinueOnError(boolean continueOnError) {
		this.continueOnError = continueOnError;
		return this;
	}

	public String getEncoding() {
		return encoding;
	}
	
	public FileUtilParams setEncoding(String encoding) {
		this.encoding = encoding;
		return this;
	}

	@Override
	public FileUtilParams clone() throws CloneNotSupportedException {
		return (FileUtilParams) super.clone();
	}
}